package com.topnav.mc.admin.dao.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.topnav.mc.admin.entity.DevicePosition;
import com.topnav.mc.admin.entity.DevicePositionTemp;
import com.topnav.mc.admin.entity.bean.DevicePositionBean;
import com.topnav.mc.admin.entity.param.DevicePositionParam;
import com.topnav.mc.base.mc.McMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DevicePositionMapper extends McMapper<DevicePosition, DevicePositionBean, DevicePositionParam> {
    String commSql = " SELECT p.* " +
            " FROM mc_device_position p " +
            " LEFT JOIN mc_device d ON p.device_id = d.id " +
            " LEFT JOIN mc_device_channel c ON p.channel_id = c.id " +
            " LEFT JOIN mc_organization o ON d.org_id = o.id " +
            " ${ew.customSqlSegment}";

    @Select(commSql)
    DevicePositionBean selectInfoOne(@Param(Constants.WRAPPER) Wrapper queryWrapper);

    @Select(commSql)
    List<DevicePositionBean> selectInfoList(@Param(Constants.WRAPPER) Wrapper queryWrapper);

    @Select(commSql)
    Page<DevicePositionBean> selectInfoPage(Page<DevicePositionParam> page, @Param(Constants.WRAPPER) Wrapper queryWrapper);
}
